<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$app = app();
// 重定向异常处理机制
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\ApiHandler::class);

//后台非登录操作
Route::group([
    'prefix' => 'v1/backend'
], function () {
    //后台登录管理
    Route::post('login', 'Admin\Admin\LoginController@login');
});

//后台登录授权后操作
Route::group([
    'prefix' => 'v1/backend',
    'middleware' => [
       'admin.check.login',
    ]
], function () {
    //登录信息管理
    Route::get('logout', 'Admin\Admin\LoginController@logout');
    Route::get('login_info', 'Admin\Admin\LoginController@loginInfo');

    //会议管理
    Route::resource('meetings', 'Admin\Meeting\MeetingsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);

    //会议用户管理
    Route::resource('meetings/{meeting_id}/users', 'Admin\Meeting\UsersController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
    Route::get('meetings/{meeting_id}/user_export', 'Admin\Meeting\UsersController@export');
    Route::post('meetings/{meeting_id}/user_import', 'Admin\Meeting\UsersController@import');
    Route::post('meetings/{meeting_id}/user_face_image', 'Admin\Meeting\UsersController@faceImage');

    //资源素材管理
    Route::post('materials', 'Admin\Material\MaterialsController@store');
});

//app客户端接口
Route::group([
    'prefix' => 'v1/client',
    'middleware' => [
        'api.check.sign',
    ]
], function () {
    //获取会议列表
    Route::get('meetings', 'Api\Meeting\MeetingsController@index');
    //获取会议用户列表
    Route::get('meetings/{meeting_id}/users', 'Api\Meeting\UsersController@index');
    Route::get('meetings/{meeting_id}/user_face_images', 'Api\Meeting\UsersController@allFaceImage');

    //人脸检索识别
    Route::put('user_persons/multifaceidentifybase', 'Api\Meeting\PersonsController@multiFaceIdentifyBase');
    //手机号签到识别
    Route::put('user_persons/verifybymobile', 'Api\Meeting\PersonsController@verifyByMobile');
});